﻿@model BrnMall.Web.MallAdmin.Models.SaleTrendModel
           
@section header{
    <title>销售趋势</title>
    <link type="text/css" rel="stylesheet" href="/admin_mall/content/css/site.css" />
    <!--[if lte IE 8]><script type="text/javascript" src="/admin_mall/scripts/excanvas.js"></script><![endif]-->
    <script type="text/javascript" src="/admin_mall/scripts/jquery.js"></script>
    <script type="text/javascript" src="/admin_mall/scripts/jquery.flot.js"></script>
    <script type="text/javascript" src="/admin_mall/scripts/showlist.js"></script>
    <script type="text/javascript">
     @{
         if (Model.TrendItemList.Rows.Count > 0)
         {
             StringBuilder data = new StringBuilder();
             StringBuilder ticks = new StringBuilder("");
             for (int i = 0; i < Model.TrendItemList.Rows.Count; i++)
             {
                 data.AppendFormat("[{0},'{1}'],", i, Model.TrendItemList.Rows[i]["value"]);
                 ticks.AppendFormat("[{0},'{1}'],", i, Model.TrendItemList.Rows[i]["time"]);
             }
             @:var data = [@Html.Raw(data.Remove(data.Length - 1, 1).ToString())];
             @:var ticks = [@Html.Raw(ticks.Remove(ticks.Length - 1, 1).ToString())];
         }
         else
         {
         @:var data = [];
         @:var ticks = [];
         }
     }
     var dataset = [{ label: "销售趋势", data: data}];
     var options = {
         series: {
             lines: { show: true },
             points: {
                 radius: 3,
                 show: true
             }
         },
		 xaxis: {
            tickSize: 1,
            tickDecimals: 0,
            ticks: ticks
            },
         yaxis: {
            tickSize: 1,
            tickDecimals: 0,
            min: 0
            },
         colors: ["#016094"]
     };
     $(function () {
         $("#TrendType").find("option[value=@Model.TrendType]").attr("selected",true)
         $("#TimeType").find("option[value=@Model.TimeType]").attr("selected",true)
         $.plot($("#flot-placeholder"), dataset, options);
     });
    </script>
}
@section body{
    @using (Html.BeginForm())
    {
    <h1 class="rightH1">
        报表统计 &gt;&gt; 销售趋势
        <div class="right">
            <a href="@ViewData["referer"]" class="menuBT">
                <img src="/admin_mall/content/images/add.jpg" />返回</a>
            <div class="clear">
            </div>
        </div>
        <div class="clear">
        </div>
    </h1>
    <div class="dataListSearch">
        <table height="32">
            <tbody>
                <tr>
                    <td width="35"><img id="searchImg" src="/admin_mall/content/images/search1.gif" /></td>
                    <td>趋势类型：</td>
                    <td width="90">
                    <select name="TrendType" id="TrendType">
                    <option value="0">订单数</option>
                    <option value="1">订单合计</option>  
                    </select>
                    </td>
                    <td>时间类型：</td>
                    <td width="66">
                    <select name="TimeType" id="TimeType">
                    <option value="0">小时</option>
                    <option value="1">天</option>  
                    <option value="2">月</option>  
                    <option value="3">年</option>  
                    </select>
                    </td>
                    <td>筛选时间：</td>
                    <td width="200">
                    <input type="text" height="28" size="10"  name="StartTime" value="@Model.StartTime"/>—
                    <input type="text" height="28" size="10"  name="EndTime" value="@Model.EndTime"/>
                    </td>
                    <td>
                    <input id="Search" name="Search" type="image" class="searchBut submit" src="/admin_mall/content/images/s.jpg" />
                    说明：年月日之间请使用字符"-"分隔
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
    <div class="dataList">
        <div id="flot-placeholder" style="width: 1100px; height: 350px; margin-left:10px;"></div>
    </div>
    }
}
